package net.lab1024.sa.admin.module.business.file.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.file.domain.form.add.DocmentAddForm;
import net.lab1024.sa.admin.module.business.file.domain.form.query.DocmentQueryForm;
import net.lab1024.sa.admin.module.business.file.domain.form.update.DocmentUpdateForm;
import net.lab1024.sa.admin.module.business.file.domain.vo.DocmentVO;
import net.lab1024.sa.admin.module.business.file.service.DocmentService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 课程分类 Controller
 *
 * @Author AKITA
 * @Date 2025-07-04 16:55:11
 * @Copyright AKITA
 */

@RestController
@Tag(name = "课程分类")
public class DocmentController {

    @Resource
    private DocmentService docmentService;

    @PostMapping("/docment/queryPage")
    public ResponseDTO<PageResult<DocmentVO>> queryPage(@RequestBody @Valid DocmentQueryForm queryForm) {
        return ResponseDTO.ok(docmentService.queryPage(queryForm));
    }

    @PostMapping("/docment/queryMyPage")
    public ResponseDTO<PageResult<DocmentVO>> queryMyPage(@RequestBody @Valid DocmentQueryForm queryForm) {
        return ResponseDTO.ok(docmentService.queryMyPage(queryForm));
    }

    @PostMapping("/docment/add")
    public ResponseDTO<Long> add(@RequestBody @Valid DocmentAddForm addForm) {
        return docmentService.add(addForm);
    }

    @PostMapping("/docment/update")
    public ResponseDTO<String> update(@RequestBody @Valid DocmentUpdateForm updateForm) {
        return docmentService.update(updateForm);
    }


    @PostMapping("/docment/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return docmentService.batchDelete(idList);
    }


    @GetMapping("/docment/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return docmentService.delete(docEntry);
    }

    @GetMapping("/docment/info/{docEntry}")
    public ResponseDTO<DocmentVO> info(@PathVariable Long docEntry) {
        return docmentService.info(docEntry);
    }
}
